//
//  AllGoosVC.m
//  夺宝吧
//
//  Created by xiaocai on 15/6/15.
//  Copyright (c) 2015年 FangYuan. All rights reserved.
//

#import "AllGoosVC.h"
#import "GoodsListTab.h"
#import "MFSideMenu.h"
#import "GoodsFromMenuView.h"
@interface AllGoosVC ()
{
    //搜索结果界面
    GoodsFromMenuView *_goodsFromMenuView;
    
}
@end

@implementation AllGoosVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.automaticallyAdjustsScrollViewInsets = NO;
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
    //加载导航条
    [self loadCustomNaviBar];
}
//加载导航条
- (void)loadCustomNaviBar
{
    UIView *naviBar = [[UIView alloc]initWithFrame:CGRectMake(0, 0, WYMWITH, 20+44)];
    naviBar.backgroundColor = QBB_RED_COLOR;
    //返回按钮
    PublicBackBtn *backBtn = [[PublicBackBtn alloc]initWithVC:self andBackType:pop Img:[UIImage imageNamed:@"icon_back_white_press"]];
    [naviBar addSubview:backBtn];

    //标题
    UILabel *titleLab = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 100, 25)];
    titleLab.center = CGPointMake(WYMWITH/2, 42);
//    titleLab.text = @"夺宝商城";
    titleLab.text = self.seach_word;
    titleLab.font = [UIFont systemFontOfSize:TITLE_SIZE];
    titleLab.textAlignment = NSTextAlignmentCenter;
    titleLab.textColor = [UIColor whiteColor];
    
    [naviBar addSubview:titleLab];
    [self.view addSubview:naviBar];
}


//通过左侧菜单按钮得到商品列表 刷新界面
- (void)reloadVCWithSeachText:(NSString *)text
{
    [_goodsFromMenuView removeFromSuperview];
    _goodsFromMenuView = [[GoodsFromMenuView alloc]initWithFrame:CGRectMake(0, 64, WYMWITH, WYMHEIGHT - 64)];
    _goodsFromMenuView.father = self;
    _goodsFromMenuView.seach_word = self.seach_word;
    [self.view addSubview:_goodsFromMenuView];
    [_goodsFromMenuView reloadDataWithSeachText:text];

}
- (void)reloadVCWithSeachClassicID:(NSString *)ClassicID
{
    [_goodsFromMenuView removeFromSuperview];
    _goodsFromMenuView = [[GoodsFromMenuView alloc]initWithFrame:CGRectMake(0, 64, WYMWITH, WYMHEIGHT - 64)];
    _goodsFromMenuView.father = self;
    _goodsFromMenuView.seach_word = self.seach_word;
        _goodsFromMenuView.backgroundColor = [UIColor whiteColor];
        [self.view addSubview:_goodsFromMenuView];
    [_goodsFromMenuView reloadDataWithClassicId:ClassicID];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
